<template>
	<view :style="themeColor">
		<view class="page">
			<view class="flex flex-wrap align-center justify-between benben-position-layout flex evaluation_flex_0"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex flex-wrap align-center evaluation_fd0_0' @tap.stop="handleJumpDiy" data-type="back"
					data-url="1">
					<image class='evaluation_fd0_0_c0' mode="aspectFit" :src='STATIC_URL+"234.png"'></image>
				</view>
				<text class='evaluation_fd0_1'>评价</text>
				<view class='flex flex-wrap align-center evaluation_fd0_0'>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
			<benben-goods-evaluate class='evaluation_flex_evaluate_1' :goods-list.sync='dataDetails.order_goods' v-model='goods_comment'>
			</benben-goods-evaluate>

			<view
				class="flex flex-direction flex-wrap align-center justify-center benben-position-layout flex evaluation_flex_2">
				<button class='evaluation_fd2_0' @tap.stop="handleSubmitFunc()">提交</button>

			</view>
			<view :style="{height: '88rpx'}"></view>


		</view>
	</view>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'
	export default {
		components: {},


		data() {
			return {
				"dataDetails": {
					"aid": "",
					"order_sn": "",
					"order_money": "",
					"payable_money": "",
					"coupon_id": "",
					"coupon_money": "",
					"send_time": "",
					"receive_time": "",
					"pay_time": "",
					"discount_money": "",
					"create_time": "",
					"pay_type": "",
					"status": "",
					"pay_type_str": "",
					"order_info": {
						"receiver_mobile": "",
						"receiver_address": "",
						"receiver_name": "",
						"remark": "",
						"province": "",
						"city": "",
						"district": "",
						"sex": "",
						"label_name": "",
						"express_price": "",
						"pickup_code": "",
						"pickup_img": ""
					},
					"order_goods_list": [],
					"shop_info": {
						"aid": "",
						"store_name": "",
						"store_logo": "",
						"store_logo_id": ""
					},
					"btn_list": {
						"cancel_order": "",
						"go_pay": "",
						"remind_send": "",
						"remind_already": "",
						"apply_invoice": "",
						"view_invoice": "",
						"apply_refund": "",
						"view_logistics": "",
						"confirm_receive": "",
						"evaluate": "",
						"delete_order": ""
					},
					"is_multiple_package": "",
					"order_type": "",
					"advance_sn": "",
					"usermerchant_id": "",
					"discount_str": "",
					"surplus_receive_time": "",
					"group_info": {
						"join_timeout": "",
						"activity_status": "",
						"group_members_nums": "",
						"join_number": ""
					},
					"group_user": [],
					"real_money": "",
					order_goods: [],
				},
				"goods_comment": "",
				"text": "shenqingchengg",
				"id": "1018",
				order_sn: "",
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {},
		onLoad(options) {
			let {
				id
			} = options
			if (id !== undefined) this.id = id
			this.order_sn = options.order_sn;
			this.queryDetailsFunc()
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//订单-订单详情
			async queryDetailsFunc() {
				//请求方法
				//数据验证

				let datadataDetails = await this.$api.post(`/${this.apiFix}/6551bb0be7151`, {
					order_sn: this.order_sn,
				});

				if (datadataDetails.data.code != 1) {
					this.$message.info(datadataDetails.data.msg);
					return
				}
				let infodataDetails = datadataDetails.data;
				const _info = infodataDetails.data;
				_info.order_goods.map(item => {
					item.refund_id = 0;
				});
				this.dataDetails = _info;
			},
			//发布评论
			async handleSubmitFunc() {
				var flag = true
				var objData = JSON.parse(this.goods_comment)
				objData.forEach(it => {
					it.content = it.content.trim();
					if (it.content == '') {
						flag = false
						return
					}
				})
				if (flag == false) {
					this.$message.info('请输入您的评价')
					flag = true
					return
				}
				//请求方法
				//数据验证

				let data64218d79d9401 = await this.$api.dbPost(`/${this.apiFix}/6551bb3ee71bb`, {
					order_sn: this.order_sn,
					comment_info: JSON.stringify(JSON.parse(this.goods_comment).map(item => {
						item.is_unname = item.type;
						item.images = item.thumb.join(",");
						item.stars = item.star;
						return item;
					})),
				});
				if (!data64218d79d9401) return
				if (data64218d79d9401.data.code != 1) {
					this.$message.info(data64218d79d9401.data.msg);
					return
				}

				this.$message.info('评论成功');
				uni.$emit('shenqingchengg', this.text);
				setTimeout(() => {
					// this.$urouter.navigateBack(1);
					uni.redirectTo({
						url: '/pages/ddgl/evaluation/evaluateSuccess'
					})
				}, 800)
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background-size: 100% auto;
		background-color: #f8f8f8;
	}

	.evaluation_flex_0 {
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 11;
		top: 0rpx;
		background-size: 100% auto !important;
		background-color: #fff;
	}

	.evaluation_fd0_1 {
		color: #333;
		font-size: 36rpx;
		font-weight: 500;
	}

	.evaluation_fd0_0_c0 {
		width: 20rpx;
		height: 36rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 0rpx 0rpx 32rpx;
	}

	.evaluation_fd0_0 {
		width: 100rpx;
		height: 88rpx;
	}

	.evaluation_flex_evaluate_1 {
		--star-color: rgba(230, 230, 230, 1);
		--star-size: 34rpx;
		--active-star-color: var(--benbenFontColor6);
		--checked-activer-color: var(--benbenFontColor5);
		--checked-size: 32rpx;
	}

	.evaluation_flex_2 {
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 11;
		bottom: calc(32rpx + var(--window-bottom));
	}

	.evaluation_fd2_0 {
		background: #F35D2A;
		border-radius: 44rpx 44rpx 44rpx 44rpx;
		font-size: 32rpx;
		color: #fff;
		width: 686rpx;
		height: 88rpx;
		line-height: 88rpx;
	}
</style>